import { observable, action, autorun,toJS } from 'mobx';
import {WeaTableNew,WeaForm} from 'comsMobx'
const {TableStore} = WeaTableNew;
import { ListStore } from './listStore';
import {Modal} from 'antd';
import {WeaTools,WeaLocaleProvider} from "ecCom"
import * as  Apis from '../apis/project';
const getLabel = WeaLocaleProvider.getLabel;

export default class ProjectReportStore  extends ListStore{	
    @observable title = getLabel(586,"项目类型");
    @observable rightMenu =[];
    @observable Condition = [];
    @observable searchParams = {};
    
    @action
    initData=(params={})=>{
        this.form = new WeaForm();
        Apis.getPrjReportCondition(params).then(data=>{
            this.title = data.title;
            this.condition = data.condition;
            this.form && !this.form.isFormInit && this.form.initFormFields(data.condition);
        })
    }
    doSearch = (params={}) =>{
        this.loading = true;
		 //获取表单的参数值
		 const searchParamsAd = this.form.getFormParams();
		 const newParams = { ...this.searchParams, ...searchParamsAd, ...params };
        Apis.getPrjReport(newParams).then(data=>{
			this.tableStore.getDatas(data.sessionkey,  params.current || 1);
			this.searchParams = { ...this.searchParams, ...params };
			this.dataKey = data.sessionkey;
			this.rightMenu = data.rightMenus;
            this.loading = false;
        })
    }

    clearStatus=()=>{
        this.rightMenu =[];
        this.Condition = [];
        this.searchParams = {};
    }

}
